import { request } from '../request';

export function rankingArticle(
  params: {
    order: 'read_num' | 'favorites' | string;
  } & Api.PageParam,
) {
  return request<
    Api.PageVO<
      {
        category: Api.Category;
        topic: { id: string; name: string };
        tagInfoList: Api.TagInfo[];
        userInfo: Api.ArticleUserVO;
        isStar: boolean;
      } & Api.Article
    >
  >({
    url: '/ranking/article',
    method: 'post',
    data: params,
  });
}

export function rankingUser(
  params: {
    order: 'read_num' | string;
  } & Api.PageParam,
) {
  return request<Api.PageVO<{ favFlag: boolean } & Api.UserInfo>>({
    url: '/ranking/user',
    method: 'post',
    data: params,
  });
}

export function rankingTag(
  params: {
    order: 'read_num' | string;
  } & Api.PageParam,
) {
  return request<Api.PageVO<{ followFlag: boolean } & Api.TagInfo>>({
    url: '/ranking/tag',
    method: 'post',
    data: params,
  });
}

export function rankingTopic(
  params: {
    order: 'read_num' | string;
  } & Api.PageParam,
) {
  return request<Api.PageVO<{ followFlag: boolean } & Api.TopicInfo>>({
    url: '/ranking/topic',
    method: 'post',
    data: params,
  });
}
